package com.lightkits.wms.controller;

import com.lightkits.wms.domain.changelabeldocument.ChangeLabelDocumentService;
import com.lightkits.wms.dto.changelabeldocument.GetChangeLabelDocumentRequest;
import com.lightkits.wms.dto.changelabeldocument.GetChangeLabelDocumentResponse;
import com.lightkits.wms.dto.changelabeldocument.SynchronousChangeLabelDocumentDataRequest;
import com.lightkits.wms.dto.changelabeldocument.SynchronousChangeLabelDocumentDataResponse;
import io.choerodon.swagger.annotation.Permission;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;


/**
 * @author lingyun.zhong@hand-china.com
 * @date 2019/7/19 14:55
 **/
@RestController
@RequestMapping(value = "ChangeLabelDocumentController")
public class ChangeLabelDocumentController {

    private ChangeLabelDocumentService documentService;

    public ChangeLabelDocumentController(ChangeLabelDocumentService documentServic) {
        this.documentService = documentServic;
    }


    @PostMapping(value = "/getChangeLabelDocument")
    @Permission(permissionPublic = true)
    @ApiOperation(value = "模糊查询换标单")
    @ResponseBody
    public GetChangeLabelDocumentResponse getChangeLabelDocument(@RequestBody GetChangeLabelDocumentRequest request) {
        GetChangeLabelDocumentResponse response = documentService.getChangeLabelDocument(request);
        response.setSuccessful(true);
        return response;
    }

    @PostMapping(value = "/synchronousChangeLabelDocumentData")
    @Permission(permissionPublic = true)
    @ApiOperation(value = "手动同步数据")
    @ResponseBody
    public SynchronousChangeLabelDocumentDataResponse synchronousChangeLabelDocumentData(
            @RequestBody(required = false) SynchronousChangeLabelDocumentDataRequest request) {
        return documentService.synchronousChangeLabelDocumentData();
    }
}
